
#ifndef SVG_SOURCE_H_
#define SVG_SOURCE_H_

#include <memory>

#include "display_options.h"
#include "image_source.h"
#include "terminal_canvas.h"

namespace tv {
class SVGImageSource final : public ImageSource {
public:
  explicit SVGImageSource(const std::string &filename)
      : ImageSource(filename) {}

  bool LoadAndScale(const DisplayOptions &options, int frame_offset,
                    int frame_count) final;

  void SendFrames(const Duration &duration, int loops,
                  const volatile sig_atomic_t &interrupt_received,
                  const Renderer::WriteFramebufferFun &sink) final;

  std::string FormatTitle(const std::string &format_string) const final;

private:
  int IndentationIfCentered(const tv::Framebuffer &image) const;

  DisplayOptions options_;
  double orig_width_, orig_height_;
  std::unique_ptr<tv::Framebuffer> image_;
};

} // namespace tv

#endif // QOI_SOURCE_H_
